<%--
 *  File:    PerformaceTypeSummary.jsp
 *  @Author: TendyHu 
 *  Date:    2010/11/04
 *
 *  Copyright (C) 2000 - 2010 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ page language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.log4j.Category"%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval"%>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom"%>

<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.PerformaceTypeSummary"); 
%>

<%
  //init param
  String strModuleName = "CRM";
  String privilegeCode = "p0102";
%>
<% 
  String contextPath = request.getContextPath();
  String strOrgid="";
  
  if(null!=request.getParameter("orgid")){
	  strOrgid=(String)request.getParameter("orgid");	  
  }  
%>


<%@ include file="/inc/CommonHeader.inc"%>
<%@ include file="/inc/OvalLocationDefault.inc"%>
<%@ include file="/inc/Print.inc"%>

<html>
<head>
<title>KPIConfig</title>
<PageFlow:CheckPageFlow pageName="p_performancetypesummary" />
<%
	HashMap pageconfiginfo = (HashMap)pageContext.getAttribute("pageconfiginfo");
	if(pageconfiginfo == null) pageconfiginfo = new HashMap();
	
	 String strTableName = "",type = "";
	 if(null!=pageconfiginfo.get("vtablename")){
		 strTableName = (String)pageconfiginfo.get("vtablename");
	 }	 
	 
	int selectmode = ((Integer)pageconfiginfo.get("selectmode")).intValue();
	switch(selectmode){
		case 1: type = "checkbox"; break;
		case 2: type = "radio";break;
		case 3: break;
	}
	String dataIdColumn = (String)pageconfiginfo.get("dataIdColumn");
	 
%>

<%@ include file="/inc/CatchError.inc"%>

<link rel="stylesheet"
	href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/cn/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript"
	src="<%=contextPath %>/js/opal2/mootools.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/opal2/opal2.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/opal2/DBGrid.js"></script>
<%@ include file="/inc/SummaryDivision.inc"%>

<script language="JavaScript">
function indicatorClick(item){
	document.cform.protocolid.value=item.value;
}
var dbGrid = null;
function page_summary(actionvalue,orderbyname){
	var editform = summaryPrepare(document.cform,actionvalue,orderbyname);
	var myHTMLRequest = new Request({
	url:'<%=contextPath%>/Dispatcher',
	onComplete: function(responseText,responseXML) {
		var data = JSON.decode(responseText);  //获取后台生成的对象	
		dbGrid.reload(data);
		dbGrid.setDefaultSelected(0);
		var isfirst = data.isfirst;
		dbGrid.setHiddenItemValue('isfirst', isfirst);
	}
						
	}).send($('cform').toQueryString());    
}
document.addEvent('domready', function (){
	
	dbGrid = new opal.widget.DBGrid({
				'id': 'summarygrid', //change id
				'data': null,
				'summaryDataName': 'summarydatas', //change
				'descColumnsName': 'columndesc',
				'indicator': {'type': '<%=type%>', 'dataIdColumn': '<%=dataIdColumn%>'}
			});
			dbGrid.display();		
			dbGrid.indicatorClick = indicatorClick;
			page_summary('search');	
});
function page_new()
{
	if(null!=document.cform.orgid){	
         self.location.href="PerformaceTypeFrm.jsp?<%= OvalTools.randomURL() %>&orgid="+document.cform.orgid;		
	}else{		
		return;
	}
}
function page_edit()
{
	if(null!=document.cform.orgid&&null!=document.cform.performancekpiid){	
		self.location.href="PerformaceTypeHeader?<%= OvalTools.randomURL() %>&orgid="+document.cform.orgid+"&performancekpiid="+document.cform.performancekpiid;		
	}else{
		alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
		return;
	}
}

function page_done()
{  
  	document.cform.actionname.value = "done";
  	isRunning = true;
  	document.cform.submit();
}
function page_delete()
{  
  	document.cform.actionname.value = "delete";
  	isRunning = true;
  	document.cform.submit();
}

</script>
</head>

<body>
<form name="cform" id="cform" method="post"
	action="<%=contextPath%>/Dispatcher"><input type="hidden"
	name="pagename" value="p_performancetypesummary" /> <input type="hidden"
	name="actionname" value="ajax" /> <input type="hidden" name="name"
	value="" /> <input type="hidden" name="type" value="" /> <input
	type="hidden" name="isfirst" id="isfirst" value="Y" /><custom:hidden
	property="languagecode" scope="session" /><input type="hidden"
	name="orgid"
	value="<%=JspHelper.filterNull( pageconfiginfo.get("orgid"))%>" /> <%-- page location   --%>
<%@ include file="/inc/PageLocation.inc"%>
<table width="100%" cellspacing="0" border="0" cellpadding="0">

	<tr>
		<td>
		<table width="100%" border="0" cellspacing="0">
			<%@ include file="/inc/SummarySearch.inc"%>
		</table>
		</td>
	</tr>

	<tr>
		<td>
		<div id="summarygrid"></div>
		<table width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="summary_top"></td>
			</tr>
			<tr>
				<td class="td_center">
				<a onclick="page_new()"><custom:button
					type="1" label="L_New" imgsrc="new.gif" border="0"
					style="width:60" /></a>
				<a onclick="page_edit()"><custom:button
					type="1" label="L_Edit" imgsrc="edit.gif" border="0"
					style="width:60" /></a>
				<a onclick="page_done()"><custom:button
					type="1" label="L_Confirm" imgsrc="finish.gif" border="0"
					style="width:60" /></a>					
				<a onclick="page_delete()"><custom:button
					type="1" label="L_Delete" imgsrc="delete.gif" border="0"
					style="width:100" /></a></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
</form>
</body>
</html>


